#!/usr/bin/env bash

source ./config/env.sh
clear


#tar -xzvf ${K8S_DATA}/unpack/kubernetes/kubernetes-src.tar.gz -C ${K8S_DATA}/unpack/kubernetes/

mkdir -p ${K8S_DATA}/config/coredns/yaml

cp ${K8S_DATA}/unpack/kubernetes/cluster/addons/dns/coredns/coredns.yaml.base ${K8S_DATA}/config/coredns/yaml/coredns.yaml
sed -i -e "s/__PILLAR__DNS__DOMAIN__/${CLUSTER_DNS_DOMAIN}/" -e "s/__PILLAR__DNS__SERVER__/${CLUSTER_DNS_SVC_IP}/" ${K8S_DATA}/config/coredns/yaml/coredns.yaml
sed -i "s#image: k8s.gcr.io/coredns:1.2.6#image: coredns/coredns:1.4.0#g" ${K8S_DATA}/config/coredns/yaml/coredns.yaml
${K8S_BIN_DIR}/kubectl apply -f ${K8S_DATA}/config/coredns/yaml/coredns.yaml

${K8S_BIN_DIR}/kubectl get all -n kube-system